using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_Page : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)
        {
            loadData();
        }
    }

    private void loadData()
    {
        DataTable dt = new DataTable();
        DAL dal = new DAL();
        int intPages_Id=0;
        try{intPages_Id=int.Parse(Request.QueryString["ID"]);}
        catch { throw new Exception("Invalid Page Id"); }
        dt = dal.getPage(Request.QueryString["ID"]);
        if(dt!=null && dt.Rows.Count>0)
        {
            txtPage_Id.Value = intPages_Id.ToString();
            txtHas_article.Value = dt.Rows[0]["Has_Article"].ToString();
            txtMenu_title.Value = dt.Rows[0]["Menu_Title"].ToString();
            txtTitle.Value=dt.Rows[0]["Title"].ToString();
            richtext.InnerHtml=dt.Rows[0]["Content"].ToString();
            txtDate_Added.Value = DateTime.Parse(dt.Rows[0]["Date_Added"].ToString()).ToString("yyyy-MM-dd"); ;
        }
    }
}
